package com.xiezc.action;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONReader;
import com.xiezc.entity.User;
import com.xiezc.util.ReqUtil;
import com.xiezc.util.RespUtil;
import org.xiezc.servlet.XHttpServlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by xiezc on 17/1/16.
 */
@WebServlet("/main")
public class MainServlet extends XHttpServlet {


    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        User user = ReqUtil.getObject(req, User.class);
        JSONObject jsonObject = (JSONObject) JSON.toJSON(user);
        RespUtil.respJSON(resp, jsonObject);
    }


}
